{extend name="admin@index_layout"/}
{block name="main"}
<form class="layui-form" method="post">
    <div class="layui-form-item c4">
        <label class="layui-form-label">logo</label>
        <div class="layui-input-block">
            <input type="text" name="row[logo_img]" id="c-pic" value="{$data.logo_img}" class="layui-input">
        </div>
        <div class="layui-input-block">
            <button type="button" class="layui-btn faupload" id="faupload-pic" data-multiple="true" data-input-id="c-pic"
                    data-preview-id="p-pic" data-type="image"><i class="layui-icon layui-icon-upload"></i> 上传
            </button>
            <button type="button" class="layui-btn fachoose" data-multiple="true" data-mimetype="image"
                    data-input-id="c-pic" id="fachoose-c-pic"><i class="iconfont icon-other"></i> 选择
            </button>
            <ul class="layui-row list-inline plupload-preview" id="p-pic"></ul>
        </div>
    </div>

    <input type="hidden" name="id" value="{$data.id}" />
    <div class="layui-form-item">
        <label class="layui-form-label">店铺名称</label>
        <div class="layui-input-block">
            <input type="text" name="row[shop_name]" autocomplete="off" placeholder="店铺名称" class="layui-input"
                   value="{$data.shop_name}" >
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">联系电话</label>
        <div class="layui-input-block">
            <input type="text" name="row[phone]" autocomplete="off" placeholder="联系电话" class="layui-input"
                   value="{$data.phone}" >
        </div>
    </div>
<!--    <div class="layui-form-item">-->
<!--        <label class="layui-form-label">医院图标：建议90*90</label>-->
<!--        <div class="layui-input-block">-->
<!--            <div class="w300">-->
<!--                <input value="{$data.img_url}" type="text"  name="row[img_url]" id="c-pic222"-->
<!--                       class="layui-input">-->
<!--            </div>-->
<!--            <button type="button" class="layui-btn faupload" id="faupload-pic222" data-multiple="false"-->
<!--                    data-input-id="c-pic222"-->
<!--                    data-preview-id="p-pic222" data-type="image"><i class="layui-icon layui-icon-upload"></i> 上传-->
<!--            </button>-->
<!--            <button type="button" class="layui-btn fachoose" data-multiple="false" data-mimetype="image"-->
<!--                    data-input-id="c-pic222" id="fachoose-c-pic222"><i class="iconfont icon-other"></i> 选择-->
<!--            </button>-->
<!--            <ul class="layui-row list-inline plupload-preview" id="p-pic222"></ul>-->
<!--        </div>-->
<!--    </div>-->

<!--    <div class="layui-form-item">-->
<!--        <label class="layui-form-label">医院标签</label>-->
<!--        <div class="layui-input-block">-->
<!--            {:Form::text('row[tag]',$data.tag,["class"=>"form-tags","lay-verify"=>"required"])}-->
<!--        </div>-->
<!--    </div>-->

<!--        <div class="layui-form-item c32">-->
<!--            <label class="layui-form-label">排序</label>-->
<!--            <div class="layui-input-block">-->
<!--                <input type="number" name="row[sort]" autocomplete="off" placeholder="排序"-->
<!--                       class="layui-input"-->
<!--                       value="{$data.sort}">-->
<!--            </div>-->
<!--        </div>-->


    <div class="layui-form-item">
        <label class="layui-form-label">省</label>
        <div class="layui-input-block">
            <select name="row[province]" lay-verify="required" lay-filter="ccc62">
                <option value="">请选择省</option>
                {volist name="proviec" id="vo"}
                <!--                <option  value="{$key.id}"  name="row[operate_type]">{$key.name}</option>-->
                <option value="{$vo.name}" <?php if( $vo['name'] == $data['province']){ ?> selected <?php }?>>{$vo.name}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">市</label>
        <div class="layui-input-block">
            <select id="c-city" name="row[city]" lay-verify="required" lay-filter="c-city">
                <option value="">请选择市</option>
                {volist name="city_list" id="vo"}
                <option value="{$vo.name}" <?php if( $vo['name'] == $data['city']){ ?> selected <?php }?>>{$vo.name}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">区</label>
        <div class="layui-input-block">
            <select id="c-city2" name="row[area]"  lay-filter="c-city2">
                <option value="">请选择区</option>
                {volist name="area_list" id="vo"}
                <option value="{$vo.name}" <?php if( $vo['name'] == $data['area']){ ?> selected <?php }?>>{$vo.name}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">详情地址</label>
        <div class="layui-input-block">
            <input type="text" name="row[address]" autocomplete="off" placeholder="详情地址:xx路xx号" class="layui-input"
                   value="{$data.address}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">快递运费</label>
        <div class="layui-input-block">
            <input type="text" name="row[express_money]" value="{$data.express_money}"   lay-verify="required|number|minDecimal"
                   autocomplete="off"
                   placeholder="快递运费"
                   class="layui-input">
        </div>
    </div>

<!--    <div class="layui-form-item" style="">-->
<!--        <label  class="layui-form-label">内容详情</label>-->
<!--        <div  class="layui-input-block">-->
<!--            <script type="text/plain" class="js-ueditor" name="row[desc]"-->
<!--                    style="position: relative;z-index: 1 !important;"-->
<!--                    id="content">{$data.desc|raw}</script>-->
<!--        </div>-->
<!--    </div>-->

<!--    <div class="layui-form-item">-->
<!--        <label class="layui-form-label">内容详情</label>-->
<!--        <div class="layui-input-block">-->
<!--            <textarea name="row[desc]" placeholder="内容详情" class="layui-textarea">{$data.desc}</textarea>-->
<!--        </div>-->
<!--    </div>-->

    <div class="layui-form-item">
        <label class="layui-form-label">经度</label>
        <div class="layui-input-block">
            <input type="text"  disabled="disabled" autocomplete="off" placeholder="经度" class="layui-input"
                   value="{$data.longitude}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">维度</label>
        <div class="layui-input-block">
            <input type="text" disabled="disabled"  autocomplete="off" placeholder="维度" class="layui-input"
                   value="{$data.latitude}">
        </div>
    </div>

    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit>提交</button>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use(['yznForm', 'laydate','form'], function () {
        var yznForm = layui.yznForm,
            laydate = layui.laydate;
        var form = layui.form;
        yznForm.bindevent($("form.layui-form"));
        laydate.render({
            elem: '#ID-laydate'
        });
        form.on('select(ccc6)', function (data) {
            console.log(data.value);
            if (data.value == 3) {
                $(".c5").show();
            } else{
                $(".c5").hide();
            }
            form.render();
        });

        form.on('select(ccc62)', function (data) {
            console.log(data.value);
            $.ajax({
                type: "POST",//规定传输方式
                url: "{:url('getc_cate')}",//提交URL
                data: {'id': data.value},//提交的数据
                success: function (result) {
                    if (result.code == 200) {
                        $("#c-city").empty();
                        var str = "<option value>请选择市</option>";
                        $.each(result.data, function (i, val) {
                            str += '<option value=' + val.name + '>' + val.name + '</option>'
                        });
                        $("#c-city").append(str);

                        $("#c-city2").empty();
                        var str2 = "<option value>请选择区</option>";
                        $("#c-city2").append(str2);

                        layui.form.render('select');
                    }
                },
                error: function () {
                    alert("获取信息失败")
                }
            });
            form.render();
        });

        form.on('select(c-city)', function (data) {
            $.ajax({
                type: "POST",//规定传输方式
                url: "{:url('getc_cate')}",//提交URL
                data: {'id': data.value},//提交的数据
                success: function (result) {
                    if (result.code == 200) {

                        $("#c-city2").empty();
                        var str = "<option value>请选择区</option>";
                        $.each(result.data, function (i, val) {
                            str += '<option value=' + val.name + '>' + val.name + '</option>'
                        });
                        $("#c-city2").append(str);
                        layui.form.render('select');
                    }
                },
                error: function () {
                    alert("获取信息失败")
                }
            });
            form.render();
        });

    });
</script>
{/block}